package com.wolfstreet.wsonline.bean;

import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.util.Map;

public class Sku {

	private float realcostPrice;

	private String amount;

	// 成本
	private float costPrice;

	// 建议售价
	private float salePrice;

	private Map<String, String> skuAttr;

	private float offerPrice;

	private String skuId;

	private float maxSaleprice;

	private float minSaleprice;

	DecimalFormat decimalFormat = new DecimalFormat("0.00");// 构造方法的字符格式这里如果小数不足2位,会以0补足.

	public String getAdvice() {
		return "¥" + decimalFormat.format(minSaleprice) + "~"
				+ decimalFormat.format(maxSaleprice);
	}

	public String getProiftis() {
		float min = minSaleprice - costPrice;
		float max = maxSaleprice - costPrice;
		return "¥" + decimalFormat.format(min) + "~"
				+ decimalFormat.format(max);
	}

	public String getProfit() {
		float p = salePrice - costPrice;
		return "¥" + decimalFormat.format(p);
	}

	private String params;

	public String getParams() {
		if (params == null) {
			StringBuffer sb = new StringBuffer();
			for (String key : skuAttr.keySet()) {
				sb.append(skuAttr.get(key) + "  ");
			}
			params = sb.toString();
		}
		return params;
	}

	public float getRealcostPrice() {
		return realcostPrice;
	}

	public void setRealcostPrice(float realcostPrice) {
		this.realcostPrice = realcostPrice;
	}

	public String getAmount() {
		return amount;
	}

	public void setAmount(String amount) {
		this.amount = amount;
	}

	public float getCostPrice() {
		return costPrice;
	}

	public void setCostPrice(float costPrice) {
		this.costPrice = costPrice;
	}

	public float getSalePirce() {
		salePrice = Float.parseFloat(decimalFormat.format(salePrice));
		return salePrice;
	}

	public void setSalePirce(float salePirce) {
		BigDecimal b = new BigDecimal(salePirce);
		this.salePrice = b.setScale(2, BigDecimal.ROUND_HALF_UP).floatValue();
	}

	public Map<String, String> getSkuAttr() {
		return skuAttr;
	}

	public void setSkuAttr(Map<String, String> skuAttr) {
		this.skuAttr = skuAttr;
	}

	public float getOfferPrice() {
		return offerPrice;
	}

	public void setOfferPrice(float offerPrice) {
		this.offerPrice = offerPrice;
	}

	public String getSkuId() {
		return skuId;
	}

	public void setSkuId(String skuId) {
		this.skuId = skuId;
	}

	public float getMaxSaleprice() {
		return maxSaleprice;
	}

	public void setMaxSaleprice(float maxSaleprice) {
		this.maxSaleprice = maxSaleprice;
	}

	public float getMinSaleprice() {
		return minSaleprice;
	}

	public void setMinSaleprice(float minSaleprice) {
		this.minSaleprice = minSaleprice;
	}

}
